package components.plugins.speak
{
	import SEApp.se_util;
	
	import UIFree.ObjectEvent;
	import UIFree.controls.uif_input;
	import UIFree.controls.uif_label;
	import UIFree.uif_component;
	
	import components.dialogs.clt_dialog;
	import components.plugins.clt_speak;
	
	import flash.events.Event;
	import flash.geom.Rectangle;

	public class clt_paramWindow extends clt_dialog {
		public static var WIDTH	: int 		= 400;
		public static var HEIGHT: int 		= 200;
		public static var TITLE	: String 	= 'Параметры речи';
		public static var DESCRIPTION: String 	= '';
		
		private var _text: uif_input;
		
		public function clt_paramWindow(parent:uif_component) {
			var inner: Rectangle = parent.getInner();
			super(parent, inner.x + (inner.width - WIDTH) / 2, inner.y + 600, WIDTH, HEIGHT, false, 1);
		}
		
		override protected function createDialogComponents(): void {
			title.text = TITLE;
			var inner: Rectangle = getInner();
			se_util.defButton(this, inner.width / 2 - se_util.DEFWIDTHBUTTON, inner.height - se_util.DEFHEIGHTBUTTON, 'Говорить', doSpeak);
			se_util.defButton(this, inner.width / 2, inner.height - se_util.DEFHEIGHTBUTTON, 'Опубликовать', doPublish);
			
			(new uif_label(this, inner.x, inner.y, inner.width, 80, 'description')).text = DESCRIPTION;
			inner.top += 85;
			_text = new uif_input(this, inner.x, inner.y, inner.width, inner.height - se_util.DEFHEIGHTBUTTON, 'minput');
			
			inner.top += _text.height;
			
			super.createDialogComponents();
		}
		
		private function doSpeak(e: Event): void {
			if (_text.text)
				clt.workspace.dispatchEvent(new ObjectEvent(clt_speak.SPEAK, _text.text));
		}
		
		protected function doPublish(e: Event): void {
			
		}
	}
}